Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ListView Disable an item

786 views
Skip to first unread message

Samson Fu

unread,
Mar 8, 2005, 4:05:07 AM3/8/05
to
I have a Listview with checkbox.
How do you disable some items (Not the whole listview)? So user cannot check/uncheck that items.

Thanks!
--
Samson Fu


Constantine Yannakopoulos

unread,
Mar 8, 2005, 10:32:51 AM3/8/05
to
Author := Samson Fu;

| I have a Listview with checkbox.
| How do you disable some items (Not the whole listview)? So user
| cannot check/uncheck that items.

Write an OnChanging event handler, test for Change = ctState and set
AllowChange to False if you want the user not to be able to
check/uncheck an item.

procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem;
Change: TItemChange; var AllowChange: Boolean);
begin
if (Change = ctState) and YourIsItemDisabled(Item) then
AllowChange := False;
end;

HTH

0 new messages